﻿<script src="~/Scripts/jquery-easyui-extensions/validatebox/jeasyui.extensions.validatebox.rules.js"></script>
<script src="~/Scripts/jquery-easyui-extensions/validatebox/jeasyui.extensions.validatebox.updateRules.js"></script>
<div class="easyui-panel" data-options="fit:true" style="padding:25px;">
    <input id="t1" name="t1" class="easyui-validatebox" data-options="required:true" />
    <br /><br />
    <a id="btn1" class="easyui-linkbutton" data-options="iconCls:'icon-add'">增加“数字规则”</a><br />
    <a id="btn2" class="easyui-linkbutton" data-options="iconCls:'icon-remove'">移除“数字规则”</a>

    <br /><br /><br />
    <a id="btn3" class="easyui-linkbutton" data-options="iconCls:'icon-add'">增加“数字、手机号码规则”</a><br />
    <a id="btn4" class="easyui-linkbutton" data-options="iconCls:'icon-remove'">移除“数字、手机号码规则”</a>
</div>

<script>
    $(function () {
        $("#btn1").click(function () {
            $("#t1").validatebox("addValidType", "integer").focus();
        });
        $("#btn2").click(function () {
            $("#t1").validatebox("removeValidType", "integer").focus();
        });

        $("#btn3").click(function () {
            $("#t1").validatebox("addValidType", ["integer", "mobile"]).focus();
        });
        $("#btn4").click(function () {
            $("#t1").validatebox("removeValidType", ["integer", "mobile"]).focus();
        });
    });
</script>